<template>
  <div class="getdate-comtainer">
		<div class="dates">{{date | formatDateTime('YYYY-MM-DD')}}</div>
    <div class="xiugai" @click="show=true">修改</div>
    <van-popup v-model="show" position="bottom">
      <van-datetime-picker
        v-model="date"
        type="date"
        @change="change"
        @cancel="show=false"
        @confirm="show=false"
      />
    </van-popup>
  </div>
</template>

<script>
export default {
  created () {
    // 设置初始时间为当天日期
    let mydate = new Date()
    this.date = new Date()
  },
  data () {
    return {
      date: '',
      times: [],
      show: false
    }
  },
  computed: {
  },
  methods: {
		change () {
      let mydate = this.date
      let data = mydate.getFullYear() + '年' + (mydate.getMonth() + 1) + '月' + mydate.getDate() + '日'
      this.$emit('getTime',data)
    }
	}
}
</script>


<style scoped lang="stylus">
  .getdate-comtainer
    width: 100%
    display: flex
    borderbottom-:1px solid #ddd
    position: relative
    .dates
      width: auto
      height: 30px
      line-height: 30px
      font-size:  0.9375rem
    .xiugai
      flex:1
      color: #108ee9
      font-size:  0.8125rem
      margin-left: 20px
      line-height: 32px
      // 隐藏时间组件
    .datetime
       opacity:0
       margin-top:0px
       position: absolute
       top: 10px
       left: 0
</style>
